package com.bwie.utils;

import lombok.Data;

import java.io.Serializable;

/**
 * @author 军哥
 * @version 1.0
 * @description: TODO
 * @date 2025/6/19 14:07
 */

public class R implements Serializable {
    private Integer code;
    private String msg;
    private Object data;
    private Boolean result;

    public static R ok(){
        R r = new R();
        r.setCode(200);
        r.setMsg("操作成功");
        r.setData(null);
        r.setResult(true);
        return r;
    }

    public static R error(){
        R r = new R();
        r.setCode(500);
        r.setMsg("操作失败");
        r.setData(null);
        r.setResult(false);
        return r;
    }

    public Integer getCode() {
        return code;
    }

    public R setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public R setMsg(String message) {
        this.msg = message;
        return this;
    }

    public Object getData() {
        return data;
    }

    public R setData(Object data) {
        this.data = data;
        return this;
    }

    public Boolean getResult() {
        return result;
    }

    public R setResult(Boolean result) {
        this.result = result;
        return this;
    }
}
